package com.zhyl.demo.service.impl;

import com.zhyl.demo.entity.Prescription;
import com.zhyl.demo.mapper.PrescriptionMapper;
import com.zhyl.demo.service.PrescriptionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @author yang3
 */
@Service
public class PrescriptionServiceImpl implements PrescriptionService {
    private final PrescriptionMapper prescriptionMapper;
    @Autowired
    private PrescriptionServiceImpl(PrescriptionMapper prescriptionMapper)
    {
        this.prescriptionMapper = prescriptionMapper;
    }

    @Override
    public Boolean addPrescription(Prescription prescription) {
        Integer integer = prescriptionMapper.addPrescription(prescription);
        if (integer>0){
            return true;
        }else {
            return false;
        }
    }

    @Override
    public Prescription getPrescriptionDetail(Integer prescriptionId) {
        Prescription prescriptionDetail = prescriptionMapper.getPrescriptionDetail(prescriptionId);
        if (prescriptionDetail!=null){
            return prescriptionDetail;
        }else {
            return null;
        }
    }
}
